import React, { lazy } from 'react';
import { Navigate, createBrowserRouter } from "react-router-dom";

const NoAuth = lazy(() => import('@/components/no_auth'));
const OnFound = lazy(() => import('@/components/on_found'));
const LayoutView = lazy(() => import('@/pages/layout'));
const LoginView = lazy(() => import('@/pages/login'));

const Home = lazy(() => import('@/pages/home'));
const Reporform = lazy(() => import('@/pages/report-form'));

const routers = createBrowserRouter([
  {
    path: "/",
    element: <LayoutView />,
    children: [
      {
        path: "/",
        element: <Home />,
      },
      {
        path: "/login",
        element: <LoginView />,
      },
      {
        path: "/report-form",
        element: <Reporform />,
      },
      {
        path: "/no-auth",
        element: <NoAuth />,
      },
      {
        path: '',
        element: <Navigate to="/Home" replace />
      },
      {
        path: "*",
        element: <OnFound />,
      },
    ]
  },
]);

export default routers;
